package org.jeecg.modules.demo.gmAdministrativeCode.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.gmAdministrativeCode.entity.GmAdministrativeCode;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: 地理位置对应行政编码
 * @Author: jeecg-boot
 * @Date:   2025-09-30
 * @Version: V1.0
 */
public interface GmAdministrativeCodeMapper extends BaseMapper<GmAdministrativeCode> {

    @Select("SELECT code FROM gm_administrative_code WHERE address LIKE CONCAT('%', #{town}, '%', #{village}, '%')")
    String getCodeByPosition(@Param("town") String town, @Param("village") String village);

    @Select("SELECT MAX(code) FROM gm_administrative_code WHERE address LIKE CONCAT('%', #{county}, '%', #{town}, '%')")
    String queryMaxCodeByCountyAndTown(@Param("county") String county, @Param("town") String town);
}
